package com.anjubao.parking.municipal.common.global;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

/**
 * code业务编码
 * 
 * @author Atom.zyu
 *
 */
@AllArgsConstructor
@NoArgsConstructor
public enum BusinessCodeEnum implements BaseEnum {
	/** 100 停车场 */
	PARKING_CODE(100, "停车场"),
	/** 110 停车场停车位 */
	PARKING_SLOT_CODE(110, "停车场停车位"),
	/** 200 停车场进出 */
	PARKING_IO_CODE(200, "停车场进出"),
	/** 300 停车场订单 */
	PARKING_ORDER_CODE(300, "停车场订单"),
	/** 400 充电桩 */
	PARKING_CHARGING_PILE_CODE(400, "充电桩"),
	/** 401 视频桩 */
	PARKING_VIDEO_PILE_CODE(401, "视频桩"),
	/** 402 地磁 */
	PARKING_GEOMAGNETIC_SENSOR_CODE(402, "地磁"),
	/** 403 pda */
	PARKING_PDA_CODE(403, "pda"),
	/** 500 诱导屏 */
	GUIDANCE_SCREEN(500, " 诱导屏"),
	
	/** 800 设备状态 */
	DEVICE_STATUS(800, "设备状态"),
	
	/** 900 支付订单 */
	PAY_ORDER_CODE(900, "支付订单"),
	/** 910 支付计费规则 */
	PAY_BILL_RULE_CODE(910, "支付计费规则");
	static final String allDesc;

	static {
		StringBuilder sb = new StringBuilder("{");
		for (BusinessCodeEnum e : BusinessCodeEnum.values()) {
			if (sb.length() >1) {
				sb.append(",");
			}
			sb.append(e.getCode()).append(":").append(e.getDesc());
		}
		sb.append("}");
		allDesc = sb.toString();

	}
	@EnumValue // 标记数据库的值是code
	private Integer code;

	private String desc;
	// :停车场业务标识，200:停车场进出业务标识，300:停车场订单业务标识

	@Override
	@JsonValue
	public int getCode() {
		return code;
	}

//	@JsonValue
	public String getDesc() {
		return desc;
	}

	public static String AllDesc() {
		return allDesc;
	}

	public static void main(String[] args) {
		System.out.println(BaseEnum.class.isAssignableFrom(BusinessCodeEnum.class));
	}
}
